<template>
	<view class="finance-container">
		<!-- 自定义导航栏 -->
		<custom-navbar title="收支明细"></custom-navbar>
		
		<!-- 账户信息卡片 -->
		<view class="account-card">
			<view class="balance-section">
				<view class="balance-amount">1500</view>
				<view class="balance-label">当前现金余额(元)</view>
				<view class="withdraw-btn" @click="goToWithdraw">提现</view>
			</view>
			
			<view class="divider-line"></view>
			
			<view class="summary-section">
				<view class="summary-item">
					<text class="summary-label">累计收入(元):  1700元</text>
				</view>
				<view class="summary-item">
					<text class="summary-label">累计提现(元):  200元</text>
				</view>
			</view>
		</view>
		
		<!-- 收支明细卡片 -->
		<view class="records-card">
			<view class="records-title">收支明细</view>
			<view class="divider"></view>
			<view class="records-list">
				<view class="record-item" v-for="(record, index) in financeRecords" :key="index">
					<view class="record-left">
						<view class="record-desc">{{ record.description }}</view>
						<view class="record-time">{{ record.time }}</view>
					</view>
					<view class="record-right">
						<view class="record-amount" :class="record.type">{{ record.amount }}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	components: {
		'custom-navbar': () => import('@/components/custom-navbar.vue')
	},
	data() {
		return {
			financeRecords: [
				{
					description: 'XX车辆清洗、抛光打蜡服务',
					time: '核销时间:2022-10-12 11:09',
					amount: '+ 50.00',
					type: 'income'
				},
				{
					description: '提现',
					time: '提现时间:2022-10-12 11:09',
					amount: '+ 200.00',
					type: 'withdraw'
				},
				{
					description: 'XX车辆清洗、抛光打蜡服务',
					time: '核销时间:2022-10-12 11:09',
					amount: '+ 50.00',
					type: 'income'
				},
				{
					description: 'XX车辆清洗、抛光打蜡服务',
					time: '核销时间:2022-10-12 11:09',
					amount: '+ 50.00',
					type: 'income'
				}
			]
		}
	},
	onLoad() {
		
	},
	methods: {
		// 跳转到提现页面
		goToWithdraw() {
			uni.navigateTo({
				url: '/pages/finance/withdraw'
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.finance-container {
	min-height: 100vh;
	background-color: #f5f5f5;
	padding-bottom: 120rpx;
	padding-top: calc(env(safe-area-inset-top) + 88rpx);
	position: relative;
	
	&::before {
		content: '';
		position: absolute;
		top: calc(env(safe-area-inset-top) + 88rpx);
		left: 0;
		right: 0;
		height: 600px;
		background-image: linear-gradient(
			to bottom,
			#2f81fa 0%, #2f81fa 27%,
			#f7f7f7 27%, #f7f7f7 100% 
		);
		background-repeat: no-repeat;
		z-index: 0;
	}
}

.divider {
			height: 7rpx;
			background: #f0f0f0;
			margin-bottom: 3rpx;
		}

// 账户信息卡片
.account-card {
	position: relative;
	z-index: 1;
	background: transparent;
	border-radius: 0;
	padding: 3rpx;
	margin: 20rpx;
	margin-top: 0rpx;
	box-shadow: none;
	display: flex;
	align-items: center;
	min-height: 300rpx;
	
	.balance-section {
		flex: 1;
		text-align: center;
		
		.balance-amount {
			font-size: 47rpx;
			font-weight: 360;
			color: #ffffff;
			margin-bottom: 16rpx;
			line-height: 1;
		}
		
		.balance-label {
			margin-top: 20rpx;
			font-weight: 350;
			font-size: 25rpx;
			color: #ffffff;
			margin-bottom: 32rpx;
			line-height: 1.2;
		}
		
		.withdraw-btn {
			background-color: #FF6600;
			color: #ffffff;
			border: none;
			border-radius: 8rpx;
			padding: 16rpx 32rpx;
			font-size: 28rpx;
			font-weight: bold;
			width: 170rpx;
			text-align: center;
			border-radius: 35rpx;
			margin-left: 50rpx;
		}
	}
	
	.divider-line {
		width: 1rpx;
		height: 200rpx;
		background-color: #e3e3e3;
		margin: 0 40rpx;
	}
	
	.summary-section {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		
		.summary-item {
			margin-bottom: 24rpx;
			
			&:last-child {
				margin-bottom: 0;
			}
			
			.summary-label {
				font-size: 24rpx;
				color: #ffffff;
				display: block;
				margin-bottom: 8rpx;
			}
			
			.summary-value {
				font-size: 24rpx;
				color: #ffffff;
				font-weight: normal;
			}
		}
	}
}

// 收支明细卡片
.records-card {
	position: relative;
	z-index: 1;
	background: #ffffff;
	border-radius: 16rpx;
	padding: 40rpx;
	margin: 20rpx;
	margin-top: -20rpx;
	box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
	min-height: calc(100vh - 500rpx);
	
	.records-title {
		font-size: 32rpx;
		font-weight: bold;
		color: #333333;
		margin-bottom: 22rpx;
		margin-top: -10rpx	}
	
	.records-list {
		.record-item {
			display: flex;
			justify-content: space-between;
			align-items: flex-start;
			padding: 24rpx 0;
			border-bottom: 1rpx solid #f0f0f0;
			
			&:last-child {
				border-bottom: none;
			}
			
			.record-left {
				flex: 1;
				
				.record-desc {
					font-size: 24rpx;
					color: #2b2b2b;
					margin-bottom: 13rpx;
					font-weight: 375;
					line-height: 1.4;
				}
				
				.record-time {
					margin-top: 10rpx;
					font-size: 20rpx;
					color: #d4d4d4;
					line-height: 1.2;
				}
			}
			
			.record-right {
				text-align: right;
				margin-left: 20rpx;
				
				.record-amount {
					font-size: 28rpx;
					font-weight: bold;
					
					&.income {
						color: #FF6600;
					}
					
					&.withdraw {
						color: #FF6600;
					}
				}
			}
		}
	}
}
</style>
